package main

import (
	"flag"
	"offline-analysis/lib"
	"os"

	_ "offline-analysis/routers"

	"gitee.com/konyshe/gogo"
)

var (
	mDebug = false
)

func help() {
	v := flag.Bool("v", false, "show version info")
	d := flag.Bool("d", false, "run debug mode")

	flag.Parse()

	if *v {
		version()
		os.Exit(1)
	}

	if *d {
		mDebug = true
	}
}

func main() {
	help()

	gogo.LogInit(lib.GetConfigData().LOG_LEVEL, lib.GetConfigData().LOG_MAX_SIZE)

	go gogo.StartWebSocket("/ws", lib.GetConfigData().SERVER_PORT+1, WSHandle)

	gogo.StartHTTP(lib.GetConfigData().SERVER_PORT)
}
